package com.leyou.trade.utils;


import com.leyou.auth.dto.UserDetail;
import com.leyou.auth.utils.UserContext;

//动态计算集合名
public class CollectionNameBuilder {
    private final String namePrefix;
    public CollectionNameBuilder(String namePrefix){
        this.namePrefix = namePrefix + "_";
    }

    public String build(){
        UserDetail user = UserContext.getUser();
        if (user == null)
            return "";
        return namePrefix+user.getId().hashCode()%100;
    }
}
